//- Copyright (C) 2023 Beijing Huaxia Chunsong Technology Co., Ltd. 
//- <https://www.chatopera.com>, Licensed under the Chunsong Public 
//- License, Version 1.0  (the "License"), https://docs.cskefu.com/licenses/v1.html
//- Unless required by applicable law or agreed to in writing, software
//- distributed under the License is distributed on an "AS IS" BASIS,
//- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//- See the License for the specific language governing permissions and
//- limitations under the License.
//- Copyright (C) 2018-Jun. 2023 Chatopera Inc, <https://www.chatopera.com>
//- Licensed under the Apache License, Version 2.0
//- http://www.apache.org/licenses/LICENSE-2.0
.uk-layui-form
    form.layui-form.uk-form(action="/apps/profile/save.html", target="maincontent")
        input(type="hidden", name="id", value=userData.id)
        if index
            input(type="hidden", name="index", value=index)
        .layui-form-item
            label.layui-form-label 用户名：
            .layui-input-inline= userData.username
            .layui-form-mid.layui-word-aux 用户登录的账号
        .layui-form-item
            label.layui-form-label 姓名：
            .layui-input-inline
                input.layui-input(type="text", name="uname", value=userData.uname, required="", lay-verify="required", placeholder="请输入用户姓名", autocomplete="off")
        .layui-form-item
            label.layui-form-label 电子邮件：
            .layui-input-inline
                input.layui-input(type="email", name="email", value=userData.email, lay-verify="required email", placeholder="请输入电子邮件地址", autocomplete="off")
        .layui-form-item
            label.layui-form-label 密码：
            .layui-input-inline
                input#password.layui-input(type="password", name="password", placeholder="请输入登录密码", lay-verify="pass", autocomplete="off")
            .layui-form-mid.layui-word-aux(style="margin-top:5px")
                input#repassword.layui-input(type="password", name="repassword", lay-verify="repass", placeholder="请再次输入密码", autocomplete="off")
        .layui-form-item
            label.layui-form-label 手机号：
            .layui-input-inline
                input.layui-input(type="mobile", name="mobile", value=userData.mobile, placeholder="请输入手机号码", autocomplete="off")
        .layui-form-button
            .layui-button-block
                button.layui-btn(lay-submit="", lay-filter="profile") 立即提交
                button.layui-btn.layui-btn-original(type="reset") 重置

script.
    layui.use('form', function () {
        var form = layui.form();
        form.on('submit(*)', function (data) {
            layerhelper.close('mainajaxwin');
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        form.render(); //更新全部
        form.verify({
            repass: function (value) {
                if (value != $('#password').val()) {
                    return '两次输入的密码不一致，请确认';
                }
            }
        });
    });
